
#include "grid_rec.h"

namespace Group5 {

GridRec::~GridRec(){}

GridRec::GridRec( Grid* g, GridRec* father_ ) {
  grid = g;
  father = father_;
}

int GridRec::path_length( GridRec * gr ) {

  if ( (*gr).father == NULL ) {
    return 1;
  }
  else {
    return 1 + path_length( (*gr).father );
  }

}

void GridRec::print_path( GridRec* gr ) {

  if ( (*gr).father == NULL ) {
    cout << *((*gr).grid) << endl;
  }
  else {
    cout << *((*gr).grid) << endl;
    print_path( (*gr).father );
  }

}

};
